package com.framework.model.common;

import com.framework.common.annotation.QueryParam;
import com.framework.common.model.validation.ValidationGroup;
import com.framework.common.util.other.NumeralUtil;
import com.framework.model.base.BaseModel;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;

/**
 * @author 龘鵺
 * @version 1.0
 * @className com.framework.model.common.Group
 * @title 附件分组类
 * @datetime 2024-07-10 15:13:10
 */
public class Group extends BaseModel implements Serializable {
    /**
     * 启用状态 ENABLE_STATUS
     */
    @NotNull(message = "请选择启用状态", groups = {ValidationGroup.formEdit.class, ValidationGroup.formAdd.class, ValidationGroup.formQuery.class})
    @Min(message = "启用状态错误", value = NumeralUtil.POSITIVE_ONE, groups = {ValidationGroup.formEdit.class, ValidationGroup.formAdd.class, ValidationGroup.formQuery.class})
    @Max(message = "启用状态错误", value = Integer.MAX_VALUE, groups = {ValidationGroup.formEdit.class, ValidationGroup.formAdd.class, ValidationGroup.formQuery.class})
    @QueryParam(name = "enableStatus", code = "p.ENABLE_STATUS")
    private Integer enableStatus;

    /**
     * 名称 NAME
     */
    @NotBlank(message = "请输入名称", groups = {ValidationGroup.formEdit.class, ValidationGroup.formAdd.class, ValidationGroup.formQuery.class})
    @Size(message = "名称最多64字符", max = 64, groups = {ValidationGroup.formEdit.class, ValidationGroup.formAdd.class, ValidationGroup.formQuery.class})
    @QueryParam(name = "name", code = "p.NAME")
    private String name;

    /**
     * 代码 CODE
     */
    @NotBlank(message = "请输入代码", groups = {ValidationGroup.formEdit.class, ValidationGroup.formAdd.class, ValidationGroup.formQuery.class})
    @Size(message = "代码最多64字符", max = 64, groups = {ValidationGroup.formEdit.class, ValidationGroup.formAdd.class, ValidationGroup.formQuery.class})
    @QueryParam(name = "code", code = "p.CODE")
    private String code;

    /**
     * 参数值 VALUE
     */
    @NotNull(message = "请选择参数值", groups = {ValidationGroup.formEdit.class, ValidationGroup.formAdd.class, ValidationGroup.formQuery.class})
    @Min(message = "参数值错误", value = NumeralUtil.POSITIVE_ONE, groups = {ValidationGroup.formEdit.class, ValidationGroup.formAdd.class, ValidationGroup.formQuery.class})
    @Max(message = "参数值错误", value = Integer.MAX_VALUE, groups = {ValidationGroup.formEdit.class, ValidationGroup.formAdd.class, ValidationGroup.formQuery.class})
    @QueryParam(name = "value", code = "p.VALUE")
    private Integer value;

    /**
     * 文件状态 STATUS
     */
    @NotBlank(message = "请输入文件状态", groups = {ValidationGroup.formEdit.class, ValidationGroup.formAdd.class, ValidationGroup.formQuery.class})
    @Size(message = "文件状态最多32字符", max = 32, groups = {ValidationGroup.formEdit.class, ValidationGroup.formAdd.class, ValidationGroup.formQuery.class})
    @QueryParam(name = "status", code = "p.STATUS")
    private String status;

    /**
     * 描述 DESCRIPTION
     */
    @NotBlank(message = "请输入描述", groups = {ValidationGroup.formEdit.class, ValidationGroup.formAdd.class, ValidationGroup.formQuery.class})
    @Size(message = "描述最多1000字符", max = 1000, groups = {ValidationGroup.formEdit.class, ValidationGroup.formAdd.class, ValidationGroup.formQuery.class})
    @QueryParam(name = "description", code = "p.DESCRIPTION")
    private String description;

    /**
     * t_group
     */
    private static final long serialVersionUID = 1L;

    public Integer getEnableStatus() {
        return enableStatus;
    }

    public void setEnableStatus(Integer enableStatus) {
        this.enableStatus = enableStatus;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name == null ? null : name.trim();
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code == null ? null : code.trim();
    }

    public Integer getValue() {
        return value;
    }

    public void setValue(Integer value) {
        this.value = value;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status == null ? null : status.trim();
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description == null ? null : description.trim();
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", enableStatus=").append(enableStatus);
        sb.append(", name=").append(name);
        sb.append(", code=").append(code);
        sb.append(", value=").append(value);
        sb.append(", status=").append(status);
        sb.append(", description=").append(description);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Group other = (Group) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getCreateId() == null ? other.getCreateId() == null : this.getCreateId().equals(other.getCreateId()))
            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
            && (this.getOperaterId() == null ? other.getOperaterId() == null : this.getOperaterId().equals(other.getOperaterId()))
            && (this.getOperaterTime() == null ? other.getOperaterTime() == null : this.getOperaterTime().equals(other.getOperaterTime()))
            && (this.getOperaterStatus() == null ? other.getOperaterStatus() == null : this.getOperaterStatus().equals(other.getOperaterStatus()))
            && (this.getEnableStatus() == null ? other.getEnableStatus() == null : this.getEnableStatus().equals(other.getEnableStatus()))
            && (this.getName() == null ? other.getName() == null : this.getName().equals(other.getName()))
            && (this.getCode() == null ? other.getCode() == null : this.getCode().equals(other.getCode()))
            && (this.getValue() == null ? other.getValue() == null : this.getValue().equals(other.getValue()))
            && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
            && (this.getDescription() == null ? other.getDescription() == null : this.getDescription().equals(other.getDescription()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getCreateId() == null) ? 0 : getCreateId().hashCode());
        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
        result = prime * result + ((getOperaterId() == null) ? 0 : getOperaterId().hashCode());
        result = prime * result + ((getOperaterTime() == null) ? 0 : getOperaterTime().hashCode());
        result = prime * result + ((getOperaterStatus() == null) ? 0 : getOperaterStatus().hashCode());
        result = prime * result + ((getEnableStatus() == null) ? 0 : getEnableStatus().hashCode());
        result = prime * result + ((getName() == null) ? 0 : getName().hashCode());
        result = prime * result + ((getCode() == null) ? 0 : getCode().hashCode());
        result = prime * result + ((getValue() == null) ? 0 : getValue().hashCode());
        result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
        result = prime * result + ((getDescription() == null) ? 0 : getDescription().hashCode());
        return result;
    }
}